import React from 'react';
import {inject, observer} from 'mobx-react';
import * as mobx from 'mobx';
import {getAntd, getEcCom,getLabel } from '../../util/convert';
import {showAuthDialog} from "../../util/secondAuthUtil"
import * as authTypes from "../../constants/secondAuthType";
export default class Main extends React.Component {
    openAuthDetail() {
        showAuthDialog(authTypes.AUTH_DETAIL_DIALOG);
    }

    getMsgContent() {
        let msgContent = <span></span>;
        const {msgtype, detail} = this.props;
        if (msgtype == "0") {
            msgContent = <span>{detail}</span>;
        } else if (msgtype == "2") {
            msgContent = (
                <div>
                    <span>{getLabel(514319, "保护数据被篡改")}！</span>
                    <a href="javascript:void(0);" onClick={this.openAuthDetail}>{getLabel(512307,"查看详情")}</a>
                </div>
            );
        }

        return msgContent;
    }

    render() {
        const {msgtype, detail} = this.props;
        if (msgtype != "0" && msgtype != "2") {
            return <div></div>
        } else {
            return (
                <div className="wf-error-msg">
                    <div className="wf-error-msg-left">
                        <i className="icon-coms-Prompt icon-coms02-Warning-01"/>
                    </div>
                    <div className="wf-error-msg-right">
                        {this.getMsgContent()}
                    </div>
                </div>
            )
        }
    }
}
